package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/10/02 17:26
 **/
public class Day31_2_Num171_TitleToNumber {
    class Solution {
        public int titleToNumber(String str) {
            int count = str.length()-1;
            int res = 0;
            for(int i = 0; i < str.length(); ++i){
                int cur = (str.charAt(i)-'A' + 1) * (int)Math.pow(26, count);
                res += cur;
                count--;
            }
            return res;
        }
    }
}